<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
    var price = [7, 1, 5, 3, 6, 4];
    function warren(price) {
      var max=0;
      for (var i = 0;i < price.length;i++) {
        for (var j = i+1;j < price.length;j++) {
          var x =  price[j]-price[i];
          if(max < x) {
            max = x;
          }
        }
      }
      return max;
    };
    console.log(warren(price))
  </script>
</head>
<body>
  
</body>
</html>